<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text" value="请输入内容">
		     <script>
		          
		          var text=document.querySelector('input');
		          
		          text.onfocus=function(){
		               
		               if(this.value==='请输入内容'){
		                    this.value='';
		               }
		              
		               this.style.color='#333';
		          }
		          
		          text.onblur=function(){
		               if(this.value===''){
		                    this.value = '请输入内容';
		               }
		               
		               this.style.color='#999';
		          }
		     </script>

	</body>
</html>